package com.ywk.dubbo.consumer.business.service;

import com.ywk.dubbo.DemoService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @Author zbh
 * @Date 2023/7/25
 */
@Component
public class Task implements CommandLineRunner {

    //通过@DubboReference 从 Dubbo 获取了一个 RPC 订阅
    @DubboReference
    private DemoService demoService;

    @Override
    public void run(String... args) throws Exception {
        String result = demoService.sayHello("world");
        System.out.println("Receive result ======> " + result);
    }
}
